<template>
  <div id="barchar"></div>
</template>

<script>
import * as echarts from "echarts";
export default {
  props: {
    dataset: Array,
    title: String,
  },
  data: function () {
    return {
      options: "",
    };
  },
  mounted: function () {
    this.options = {
      title: {
        text: "销量排名",
      },
      tooltip: {
        trigger: "axis",
        axisPointer: {
          type: "shadow",
        },
      },
      legend: {
        data: ["昨日", "今日"],
      },
      grid: {
        left: "3%",
        right: "4%",
        bottom: "3%",
        containLabel: true,
      },
      xAxis: {
        type: "value",
        boundaryGap: [0, 0.01],
      },
      yAxis: {
        type: "category",
        data: ["大蒜", "玉米", "花生", "土豆", "黄豆", "高粱"],
      },
      series: [
        {
          name: "昨日",
          type: "bar",
          data: [111,222,333,444,555,666],
        },
        {
          name: "今日",
          type: "bar",
          data: [123,234,345,456,567,678],
        },
      ],
    };
    var chart = echarts.init(document.getElementById("barchar"));
    chart.setOption(this.options);
  },
};
</script>

<style>
#barchar {
  height: 190px;
  width: 350px;

}
</style>